import { createRouter, createWebHistory } from "vue-router";
import Dashboard  from "@/views/job/Dashboard.vue";
import Admin  from "@/views/component/Admin.vue";
import User  from "@/views/job/User.vue";
import Goods from "@/views/job/Goods.vue";
import Comment from "@/views/job/Comment.vue";
import ElmentTest from "@/views/job/ElmentTest.vue";
import ElAdmin from "@/views/job/ElAdmin.vue";
import Math from "@/views/job/Math.vue"
import GoodsMassage from "@/views/goods/GoodsMassage.vue"
import UserIndex from "@/views/component/UserIndex.vue";
import index from "@/views/goods/Index.vue";
import Announcement from "@/views/goods/Announcement.vue";
import CategoryList from "@/views/goods/CategoryList.vue";
import PersonalCenter from "@/views/goods/PersonalCenter.vue";
import ShoppingCar from "@/views/goods/ShoppingCar.vue";
import MovieDetail  from "@/views/goods/MovieDetail.vue";
import Login from "@/views/user/Login.vue"
   
  
const routes = [
  { path: "/", redirect: "/login" },
     //以下是在routes数组中的新增规则
   {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
    path: "/goodsMassage",
    name: "GoodsMassage",
    component: GoodsMassage,
    },
     //9月作业
     {
    path: "/dashboard",//制定规则
    name: "Dashboard",
    component: Dashboard,
    redirect:"/dashboard/admin",//重定向
    children:[
        {path: "admin",name: "Admin",component: Admin,},
    {path: "user",name: "DashboardUser",component: User,},
    {path:"goods",name: "DashboardGoods",component: Goods,},
    {path:"comment",name: "DashboardComment",component: Comment,},
    ]
    
},
//轮播图
{
    path:"/elmenttest",
    name: "ElmentTest",
     component: ElmentTest,
     redirect:"/elmenttest/eladmin",
     children:[
       {path:"eladmin",name:"ElAdmin",component:ElAdmin,},
       {path:"math", name:"Math",component:Math,}

     ] 
},
//用户界面
{
 path:"/userindex",
 name: "UserIndex",
 component: UserIndex,
 redirect:"/userindex/index",
 children:[
   {path:"index",name:"Index",component:index,},
   {path:"categorylist",name:"CategoryList",component:CategoryList,},
   {path:"announcement",name:"Announcement",component:Announcement,},
   {path:"personalcenter",name:"PersonalCenter",component:PersonalCenter,},
   {path:"shoppingcar",name:"ShoppingCar",component:ShoppingCar,},
   {path:"moviedetail",name:"MovieDetail",component:MovieDetail,},
 ]
}
    
]
;
// 创建路由实例并传递 `routes` 配置
const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;